

<template>
  <div>
    <a-modal
      :title="title"
      v-bind="$attrs"
      v-model:visible="visible"
      :confirm-loading="loading"
      @ok="handleOk"
      @cancel="handleCancel"
    >
      <slot />
       
    </a-modal>
  </div>
</template>
<script>
import {
  defineComponent,
  ref,
  watch,
} from 'vue';


export default defineComponent({

  emits: {
    closeDialog: null,
    handForm: null
  },
  props: {
    title: String,
    loading: Boolean,
    visible: Boolean,
    checkForm: Boolean,
  },
  setup(_, { attrs, emit }) {
    let visible = ref(_.visible);
    const loading = ref(_.loading);
    const dialog = ref(null)
    const handleOk = () => {
      emit("handForm");
    };

    const handleCancel = () => {
      emit("closeDialog", false);
    }
    const handleUpload = () => {
      console.log(4444)
    }
    watch(() => [_.visible, _.loading], ([newV, newL]) => {
      visible.value = newV
      loading.value = newL
    })

    return {
      dialog,
      visible,
      loading,
      handleOk,
      handleCancel,
      handleUpload
    };
  },
});
</script>
